using System;
using System.Windows.Media.Animation;

namespace MvvmFx.Common.ViewModels.Commands
{
    /// <summary>
    /// A StoryboardCommandHandler inherits from <see cref="ActionCommandHandler"/>
    /// and encapsulates the logic to begin a <see cref="Storyboard"/> after
    /// the <see cref="IViewModelCommand"/> it is handling is executed.
    /// </summary>
    /// <typeparam name="T">The type of command that this is handling</typeparam>
    public class StoryboardCommandHandler<T> : ActionCommandHandler<T>
        where T : IViewModelCommand
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="StoryboardCommandHandler&lt;T&gt;"/> class.
        /// </summary>
        /// <param name="storyboard">The storyboard.</param>
        public StoryboardCommandHandler(Storyboard storyboard)
            : base((cmd, param) => storyboard.Begin())
        {

        }
    }

    /// <summary>
    /// A StoryboardCommandHandler inherits from <see cref="ActionCommandHandler"/>
    /// and encapsulates the logic to begin a <see cref="Storyboard"/> after
    /// the <see cref="IViewModelCommand"/> it is handling is executed.
    /// </summary>
    public class StoryboardCommandHandler : ActionCommandHandler
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="StoryboardCommandHandler"/> class.
        /// </summary>
        /// <param name="storyboard">The storyboard.</param>
        public StoryboardCommandHandler(Storyboard storyboard)
            : base((cmd, param) => storyboard.Begin())
        {

        }
    }
}